from flask import g, jsonify


def login(func):
    def wapper(*args,**kwargs):
        if g.uid == 0:
            return jsonify({
                "code": 403,
                "msg": "用户未登录"
            })
        return func(*args,**kwargs)
    return wapper